<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Tail Calls (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Tail Calls (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Tail Calls (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Stack-and-Calling.html" rel="up" title="Stack and Calling">
<link href="Shrink_002dwrapping-separate-components.html" rel="next" title="Shrink-wrapping separate components">
<link href="Profiling.html" rel="prev" title="Profiling">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Tail-Calls">
<div class="nav-panel">
<p>
Next: <a href="Shrink_002dwrapping-separate-components.html" accesskey="n" rel="next">Shrink-wrapping separate components</a>, Previous: <a href="Profiling.html" accesskey="p" rel="prev">Generating Code for Profiling</a>, Up: <a href="Stack-and-Calling.html" accesskey="u" rel="up">Stack Layout and Calling Conventions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Permitting-tail-calls"><span>18.9.13 Permitting tail calls<a class="copiable-link" href="#Permitting-tail-calls"> &para;</a></span></h4>
<a class="index-entry-id" id="index-tail-calls"></a>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fFUNCTION_005fOK_005fFOR_005fSIBCALL"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_FUNCTION_OK_FOR_SIBCALL</strong> <code class="def-code-arguments">(tree <var class="var">decl</var>, tree <var class="var">exp</var>)</code><a class="copiable-link" href="#index-TARGET_005fFUNCTION_005fOK_005fFOR_005fSIBCALL"> &para;</a></span></dt>
<dd><p>True if it is OK to do sibling call optimization for the specified
call expression <var class="var">exp</var>.  <var class="var">decl</var> will be the called function,
or <code class="code">NULL</code> if this is an indirect call.
</p>
<p>It is not uncommon for limitations of calling conventions to prevent
tail calls to functions outside the current unit of translation, or
during PIC compilation.  The hook is used to enforce these restrictions,
as the <code class="code">sibcall</code> md pattern cannot fail, or fall over to a
&ldquo;normal&rdquo; call.  The criteria for successful sibling call optimization
may vary greatly between different architectures.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fEXTRA_005fLIVE_005fON_005fENTRY"><span class="category-def">Target Hook: </span><span><code class="def-type">void</code> <strong class="def-name">TARGET_EXTRA_LIVE_ON_ENTRY</strong> <code class="def-code-arguments">(bitmap <var class="var">regs</var>)</code><a class="copiable-link" href="#index-TARGET_005fEXTRA_005fLIVE_005fON_005fENTRY"> &para;</a></span></dt>
<dd><p>Add any hard registers to <var class="var">regs</var> that are live on entry to the
function.  This hook only needs to be defined to provide registers that
cannot be found by examination of FUNCTION_ARG_REGNO_P, the callee saved
registers, STATIC_CHAIN_INCOMING_REGNUM, STATIC_CHAIN_REGNUM,
TARGET_STRUCT_VALUE_RTX, FRAME_POINTER_REGNUM, EH_USES,
FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, and the PIC_OFFSET_TABLE_REGNUM.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fSET_005fUP_005fBY_005fPROLOGUE"><span class="category-def">Target Hook: </span><span><code class="def-type">void</code> <strong class="def-name">TARGET_SET_UP_BY_PROLOGUE</strong> <code class="def-code-arguments">(struct hard_reg_set_container *<var class="var"></var>)</code><a class="copiable-link" href="#index-TARGET_005fSET_005fUP_005fBY_005fPROLOGUE"> &para;</a></span></dt>
<dd><p>This hook should add additional registers that are computed by the prologue
to the hard regset for shrink-wrapping optimization purposes.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fWARN_005fFUNC_005fRETURN"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_WARN_FUNC_RETURN</strong> <code class="def-code-arguments">(tree)</code><a class="copiable-link" href="#index-TARGET_005fWARN_005fFUNC_005fRETURN"> &para;</a></span></dt>
<dd><p>True if a function&rsquo;s return statements should be checked for matching
the function&rsquo;s return type.  This includes checking for falling off the end
of a non-void function.  Return false if no such check should be made.
</p></dd></dl>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Shrink_002dwrapping-separate-components.html">Shrink-wrapping separate components</a>, Previous: <a href="Profiling.html">Generating Code for Profiling</a>, Up: <a href="Stack-and-Calling.html">Stack Layout and Calling Conventions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
